﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TNOWS07 : UIWF
    {

        public TNOWS07()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VWAFARBEN();
            this.DataContext = MV;
            InitializeComponent();
        }
       
        public override void LOADBYAUF()
        {
            base.LOADBYAUF();
            if (TBMain.Rows.Count > 0)
                return;
            if (ORDERNUM.Length < 32)
                return;
            PM["ART"] = ORDERNUM.Substring(0, 20);
            PM["VAR"] = ORDERNUM.Substring(20, 2);
            PM["DES"] = ORDERNUM.Substring(23, 10);
            PM["FARBE"] = ORDERNUM.Substring(23, 10);
            PM["FINISH"] = FINISH.PadRight(10);
            PM["DESS"] = DESS.PadRight(10);
            PM["COLORIT"] = COLORIT.PadRight(10);
            if (IsYD)
            {
                PM["ZUART"] = "C";
            }
            else
            {
                PM["ZUART"] = "F";
            }
            TMV.NEWWA(PM);
            vwMaster.View.MoveCurrentToFirst();
        }
        public override void OnEXAUFChg(string vlaue)
        {
            if (vlaue.Length == 0)
                return;
            ARTST = vlaue.Substring(0, 1);
            ART = vlaue.Substring(1, 20);
            FARBE = vlaue.Substring(23, 10);
            DES = vlaue.Substring(1 + 20 + 2 + 10 * 4 + 7, 20);
            FINISH = vlaue.Substring(33, 10);
            DESS = vlaue.Substring(43, 10);
            COLORIT = vlaue.Substring(53, 10);
            IsNew = true;
            PM["ARTST"] = ARTST;
            PM["KOLL"] = KOLL;
            PM["ART"] = ART;
            PM["VAR"] = vlaue.Substring(21, 2);
            PM["FARBE"] = FARBE;
            PM["DES"] = DES;
            PM["FINISH"] = FINISH.PadRight(10);
            PM["DESS"] = DESS.PadRight(10);
            PM["COLORIT"] = COLORIT.PadRight(10);
            if (IsYD)
            {
                PM["ZUART"] = "C";
            }
            else
            {
                PM["ZUART"] = "F";
            }
            TMV.NEWWA(PM);
            base.OnEXAUFChg(vlaue);
        }
    }
}
